class Admin::BaseController < ApplicationController
  include BreadcurmbModule
  layout :admin_layout
  def admin_layout
    request.headers['X-PJAX'] ? 'admin/pjax' : 'admin/application'
  end

  rescue_from CanCan::AccessDenied do |exception|
    # flash[:alert] = exception.message
    # render 'admin/base/access_denied'
    redirect_to admin_access_denied_path, alert: exception.message
  end

  def access_denied

  end

  def after_sign_in_path_for(resource = nil)
    path = nil
    if(can? :manage, User)
      #超级管理员
      path = admin_users_path
    end
    if(resource)
      return path
    else
      redirect_to(path)
    end
  end

end